namespace QMVnSoft.ReportForms
{
    using QMVnSoft;
    using QMVnSoft.Controls;
    using QMVnSoft.DAL;
    using System;
    using System.ComponentModel;
    using System.Drawing;
    using System.Windows.Forms;

    public class FormKCT072Viewer : FormReportViewer
    {
        private IContainer components;
        private object ii_TTien;
        private object ii_TTien3;
        private LabelControl lblHD_Huy;
        private LabelControl lblHD_Huy0;
        private LabelControl lblNgay_Ct1;
        private LabelControl lblNgay_Ct2;
        private LabelControl lblTk;
        private TextOption txtHD_Huy;
        private TextDate txtNgay_Ct1;
        private TextDate txtNgay_Ct2;
        private TextControl txtTen_Tk;
        private TextSearch txtTk;

        public FormKCT072Viewer()
        {
            this.ii_TTien = 0;
            this.ii_TTien3 = 0;
            this.InitializeComponent();
            this.txtNgay_Ct1.Value = AppInstance.StartWorkingDate;
            this.txtNgay_Ct2.Value = AppInstance.EndWorkingDate;
            this.txtTk.Value = "3331";
        }

        public FormKCT072Viewer(object pd_Ngay_Ct1, object pd_Ngay_Ct2)
        {
            this.ii_TTien = 0;
            this.ii_TTien3 = 0;
            this.InitializeComponent();
            this.txtNgay_Ct1.Value = pd_Ngay_Ct1;
            this.txtNgay_Ct2.Value = pd_Ngay_Ct2;
            this.txtTk.Value = "3331";
            this.txtTen_Tk.Value = this.txtTk.GetFieldData("Ten_Tk");
            this.OnMakeReport();
        }

        protected override void Dispose(bool disposing)
        {
            if (disposing && (this.components != null))
            {
                this.components.Dispose();
            }
            base.Dispose(disposing);
        }

        private void InitializeComponent()
        {
            //ComponentResourceManager manager = new ComponentResourceManager(typeof(FormKCT072Viewer));
            this.lblHD_Huy0 = new LabelControl();
            this.txtHD_Huy = new TextOption();
            this.txtTen_Tk = new TextControl();
            this.txtTk = new TextSearch();
            this.lblHD_Huy = new LabelControl();
            this.lblTk = new LabelControl();
            this.txtNgay_Ct2 = new TextDate();
            this.lblNgay_Ct2 = new LabelControl();
            this.txtNgay_Ct1 = new TextDate();
            this.lblNgay_Ct1 = new LabelControl();
            base.rptContainer.Panel1.SuspendLayout();
            base.rptContainer.SuspendLayout();
            base.SuspendLayout();
            base.rptContainer.Panel1.Controls.Add(this.txtNgay_Ct2);
            base.rptContainer.Panel1.Controls.Add(this.lblNgay_Ct2);
            base.rptContainer.Panel1.Controls.Add(this.txtNgay_Ct1);
            base.rptContainer.Panel1.Controls.Add(this.lblNgay_Ct1);
            base.rptContainer.Panel1.Controls.Add(this.lblHD_Huy0);
            base.rptContainer.Panel1.Controls.Add(this.txtHD_Huy);
            base.rptContainer.Panel1.Controls.Add(this.txtTen_Tk);
            base.rptContainer.Panel1.Controls.Add(this.txtTk);
            base.rptContainer.Panel1.Controls.Add(this.lblHD_Huy);
            base.rptContainer.Panel1.Controls.Add(this.lblTk);
            base.rptContainer.SplitterDistance = 0x43;
            this.lblHD_Huy0.AutoSize = true;
            this.lblHD_Huy0.Font = new Font("Arial", 8.25f);
            this.lblHD_Huy0.ForeColor = Color.Blue;
            this.lblHD_Huy0.Location = new Point(0x88, 0x1b);
            this.lblHD_Huy0.Name = "lblHD_Huy0";
            this.lblHD_Huy0.Size = new Size(0xf1, 14);
            this.lblHD_Huy0.TabIndex = 0x5c;
            this.lblHD_Huy0.Text = "C-C\x00f3 lấy hóa đơn huỷ, K-Không lấy hóa đơn huỷ";
            this.txtHD_Huy.CharacterCasing = CharacterCasing.Upper;
            this.txtHD_Huy.CheckTextSearched = false;
            this.txtHD_Huy.DisabledForeColor = Color.Blue;
            this.txtHD_Huy.Font = new Font("Arial", 8.25f);
            this.txtHD_Huy.InputMask = "K,C";
            this.txtHD_Huy.Location = new Point(0x6c, 0x18);
            this.txtHD_Huy.Name = "txtHD_Huy";
            this.txtHD_Huy.OldValue = null;
            this.txtHD_Huy.Size = new Size(0x16, 20);
            this.txtHD_Huy.TabIndex = 1;
            this.txtHD_Huy.Text = "K";
            this.txtHD_Huy.TextAlign = HorizontalAlignment.Center;
            this.txtHD_Huy.Value = "K";
            this.txtTen_Tk.Anchor = AnchorStyles.Right | AnchorStyles.Left | AnchorStyles.Top;
            this.txtTen_Tk.BackColor = SystemColors.Control;
            this.txtTen_Tk.BorderStyle = BorderStyle.None;
            this.txtTen_Tk.CheckTextSearched = false;
            this.txtTen_Tk.DisabledForeColor = Color.Blue;
            this.txtTen_Tk.Enabled = false;
            this.txtTen_Tk.Font = new Font("Arial", 8.25f);
            this.txtTen_Tk.ForeColor = Color.Blue;
            this.txtTen_Tk.Location = new Point(0xd6, 6);
            this.txtTen_Tk.Name = "txtTen_Tk";
            this.txtTen_Tk.OldValue = null;
            this.txtTen_Tk.Size = new Size(0x1ca, 13);
            this.txtTen_Tk.TabIndex = 0x5b;
//            this.txtTen_Tk.Value = null;//manager.GetObject("txtTen_Tk.Value");
            this.txtTk.CharacterCasing = CharacterCasing.Upper;
            this.txtTk.CheckTextSearched = false;
            this.txtTk.DisabledForeColor = Color.Empty;
            this.txtTk.FieldDisplay = "Ten_Tk";
            this.txtTk.Font = new Font("Arial", 8.25f);
            this.txtTk.FoundIsValid = true;
            this.txtTk.Location = new Point(0x6c, 3);
            this.txtTk.MaxLength = 0x20;
            this.txtTk.Name = "txtTk";
            this.txtTk.OldValue = null;
            this.txtTk.Size = new Size(100, 20);
            this.txtTk.TabIndex = 0;
            this.txtTk.TableName = "DMTK";
            this.txtTk.TextDisplay = this.txtTen_Tk;
            this.txtTk.UserTextLength = AppInstance.TextControlLength.ItemCode;
            this.txtTk.UserTrimMode = AppInstance.TextControlTrimMode.All;
//            this.txtTk.Value = null;//manager.GetObject("txtTk.Value");
            this.lblHD_Huy.AutoSize = true;
            this.lblHD_Huy.Font = new Font("Arial", 8.25f);
            this.lblHD_Huy.Location = new Point(12, 0x1b);
            this.lblHD_Huy.Name = "lblHD_Huy";
            this.lblHD_Huy.Size = new Size(0x30, 14);
            this.lblHD_Huy.TabIndex = 0x58;
            this.lblHD_Huy.Text = "hóa đơn";
            this.lblTk.AutoSize = true;
            this.lblTk.Font = new Font("Arial", 8.25f);
            this.lblTk.Location = new Point(12, 6);
            this.lblTk.Name = "lblTk";
            this.lblTk.Size = new Size(0x35, 14);
            this.lblTk.TabIndex = 0x57;
            this.lblTk.Text = "Tài khoản";
            this.txtNgay_Ct2.DateTimeFormat = TextDate.DateTimeFormatType.Date;
            this.txtNgay_Ct2.Font = new Font("Arial", 8.25f);
            this.txtNgay_Ct2.InsertKeyMode = InsertKeyMode.Overwrite;
            this.txtNgay_Ct2.Location = new Point(0x13c, 0x2d);
            this.txtNgay_Ct2.Mask = "00/00/0000";
            this.txtNgay_Ct2.Name = "txtNgay_Ct2";
            this.txtNgay_Ct2.OldValue = null;
            this.txtNgay_Ct2.Size = new Size(100, 20);
            this.txtNgay_Ct2.TabIndex = 3;
//            this.txtNgay_Ct2.Value = null;//manager.GetObject("txtNgay_Ct2.Value");
            this.lblNgay_Ct2.AutoSize = true;
            this.lblNgay_Ct2.Font = new Font("Arial", 8.25f);
            this.lblNgay_Ct2.Location = new Point(0x100, 0x30);
            this.lblNgay_Ct2.Name = "lblNgay_Ct2";
            this.lblNgay_Ct2.Size = new Size(0x36, 14);
            this.lblNgay_Ct2.TabIndex = 0x61;
            this.lblNgay_Ct2.Text = "Đến ngày";
            this.txtNgay_Ct1.DateTimeFormat = TextDate.DateTimeFormatType.Date;
            this.txtNgay_Ct1.Font = new Font("Arial", 8.25f);
            this.txtNgay_Ct1.InsertKeyMode = InsertKeyMode.Overwrite;
            this.txtNgay_Ct1.Location = new Point(0x6c, 0x2d);
            this.txtNgay_Ct1.Mask = "00/00/0000";
            this.txtNgay_Ct1.Name = "txtNgay_Ct1";
            this.txtNgay_Ct1.OldValue = null;
            this.txtNgay_Ct1.Size = new Size(100, 20);
            this.txtNgay_Ct1.TabIndex = 2;
//            this.txtNgay_Ct1.Value = null;//manager.GetObject("txtNgay_Ct1.Value");
            this.lblNgay_Ct1.AutoSize = true;
            this.lblNgay_Ct1.Font = new Font("Arial", 8.25f);
            this.lblNgay_Ct1.Location = new Point(12, 0x30);
            this.lblNgay_Ct1.Name = "lblNgay_Ct1";
            this.lblNgay_Ct1.Size = new Size(0x2f, 14);
            this.lblNgay_Ct1.TabIndex = 0x62;
            this.lblNgay_Ct1.Text = "Từ ngày";
            base.AutoScaleDimensions = new SizeF(6f, 13f);
            base.CheckDetailMost = true;
            base.ClientSize = new Size(0x31a, 0x1cf);
            base.Name = "FormKCT072Viewer";
            base.rptContainer.Panel1.ResumeLayout(false);
            base.rptContainer.Panel1.PerformLayout();
            base.rptContainer.ResumeLayout(false);
            base.ResumeLayout(false);
            base.PerformLayout();
        }

        protected override void OnGenerateColumns()
        {
            object[][] objArray = new object[10][];
            objArray[0] = new object[] { "Stt_Inv", "Số thứ tự", "N", AppInstance.TextNumericFormat.IntNumber };
            object[] objArray3 = new object[4];
            objArray3[0] = "So_Seri0";
            objArray3[1] = "K\x00fd hiệu";
            objArray3[2] = "C";
            objArray[1] = objArray3;
            object[] objArray4 = new object[4];
            objArray4[0] = "So_Ct0";
            objArray4[1] = "Số hóa đơn";
            objArray4[2] = "C";
            objArray[2] = objArray4;
            object[] objArray5 = new object[4];
            objArray5[0] = "Ngay_Ct0";
            objArray5[1] = "Ngày";
            objArray5[2] = "D";
            objArray[3] = objArray5;
            object[] objArray6 = new object[4];
            objArray6[0] = "Ten_DtGTGT";
            objArray6[1] = "Tên người mua";
            objArray6[2] = "C";
            objArray[4] = objArray6;
            object[] objArray7 = new object[4];
            objArray7[0] = "Ma_DtGTGT";
            objArray7[1] = "Mã số thuế";
            objArray7[2] = "C";
            objArray[5] = objArray7;
            object[] objArray8 = new object[4];
            objArray8[0] = "Dien_Giai";
            objArray8[1] = "Mặt hàng";
            objArray8[2] = "C";
            objArray[6] = objArray8;
            objArray[7] = new object[] { "Tien", "Doanh số bán chưa thuế", "N", AppInstance.TextNumericFormat.LocalAmount };
            objArray[8] = new object[] { "Thue_GTGT", "Thuế suất", "N", AppInstance.TextNumericFormat.Percent };
            objArray[9] = new object[] { "Tien3", "Thuế GTGT", "N", AppInstance.TextNumericFormat.LocalAmount };
            base.LocalColNames = objArray;
            base.OnGenerateColumns();
        }

        protected override void OnMakeReport()
        {
            AppInstance.StartWorkingDate = (DateTime) this.txtNgay_Ct1.Value;
            AppInstance.EndWorkingDate = (DateTime) this.txtNgay_Ct2.Value;
            object obj2 = 0;
            object obj3 = 0;
            base.LocalTable = new ReportDataAccess().KCT072_Get(AppInstance.Subsidiaries, this.txtNgay_Ct1.Value, this.txtNgay_Ct2.Value, this.txtTk.Value, this.txtHD_Huy.Value, ref obj2, ref obj3, AppInstance.DefLanguage);
            this.ii_TTien = obj2;
            this.ii_TTien3 = obj3;
            base.OnMakeReport();
        }

        protected override void OnSendParameters()
        {
            base.StimulReport["Ngay"] = "Từ ngày " + string.Format("{0:dd/MM/yyyy}", this.txtNgay_Ct1.Value) + " đến ngày " + string.Format("{0:dd/MM/yyyy}", this.txtNgay_Ct2.Value);
            base.StimulReport["Ms_Thue"] = AppInstance.TaxCodeOfSubEnterprice;
            base.StimulReport["TTien"] = this.ii_TTien;
            base.StimulReport["TTien3"] = this.ii_TTien3;
        }
    }
}

